package edu.android.com;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.ListView;
import com.google.ads.*;

public class GraphTheory extends Activity {
	
	public static float widthScale,heightScale;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        //Menu
        manageMenu();
        
        //Resolution
        DisplayMetrics metrics = new DisplayMetrics();
        Window window = getWindow();
        window.getWindowManager().getDefaultDisplay().getMetrics(metrics);
        widthScale = (metrics.densityDpi/160f);
        heightScale = (metrics.densityDpi/160f);
    }
    
    private void manageMenu()
    {
    	//Menu
        String [] items = new String[]{
        		"Undirected Graphs",
        		"Directed Graphs",
        		"About"};
        
        ArrayAdapter adapter = new ArrayAdapter <String>(this,R.layout.textview,items);
        ListView list = (ListView)findViewById(R.id.mainList);
        list.setAdapter(adapter);
        
        list.setOnItemClickListener(new OnItemClickListener(){

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				// TODO Auto-generated method stub
				Intent intent;
				switch(arg2){
				case 0:
					intent = new Intent(GraphTheory.this,undirected.class);
					startActivity(intent);
					break;
				case 1:
					intent = new Intent(GraphTheory.this,directed.class);
					startActivity(intent);
					break;
				case 2:
					intent = new Intent(GraphTheory.this,help.class);
					startActivity(intent);
					break;
				}
			}
        	
        });
        
    }
}